import { mapGetters } from "vuex";
export default {
    computed:{
        ...mapGetters('m_cart',['total'])
    },
    watch:{
        total(){
            this.setBadge()
        }
    },
    onShow(){
        this.setBadge()
    },
    methods: {
        setBadge(){
            if (this.getTotal > 0) {
                uni.setTabBarBadge({
                    index:2,
                    text:this.getTotal+''
                }) 
            }else{
                uni.removeTabBarBadge({index:2})
            }
        }
    },
}